const mongoose =require("mongoose");
const Schema=mongoose.Schema;

//Create Scahema
const ReturnedBillSchema=new Schema({
    returnedCode:{//退货单号
        type:String,
        required:true
    },
    saleId:{//销售单号
        type:mongoose.Types.ObjectId,
        required:true,
        ref:'SaleBill'
    },
    saleCode:{//销售单号
        type:String,
        required:true,
        ref:'SaleBill'
    },
    name:{//品名
        type:String,
        required:true
    },
    number:{//品号
        type:String,
        required:true
    },
    inPiece:{
        type:Number,
    },
    inLength:{
        type:Number,
    },
    customer:{
        type:String, //客户
        required:true
    },
    warehouse:{//仓库
        type:String,
        required:true
    },
    price:{
        type:Number,
        required:true
    },
    money:{
        type:Number,
        required:true
    },
    date:{
        type:Date,
        required:true
    },
    operator:{//操作人员
        type:String,
        required:true
    },
    dateFill:{//填写日期
        type:Date,
        default:Date.now
    },
    remark:{//备注
        type:String,
    },
})

module.exports=mongoose.model("ReturnedBill",ReturnedBillSchema);